package com.binary.coder.gift.core.infrastructure.repository.invitation;

import com.binary.coder.gift.core.domain.invitation.repository.AppInvitationRepository;
import com.binary.coder.gift.core.infrastructure.mapper.invitation.AppInvitationCardMapper;
import com.binary.coder.gift.core.infrastructure.po.invitation.AppInvitationCard;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * @author atao
 * @version 1.0.0
 * @ClassName AppInvitationRepositoryImpI.java
 * @Description Invitation仓储接口
 * @createTime 2025年02月05日 19:51:00
 */
@Repository
public class AppInvitationRepositoryImpI implements AppInvitationRepository {

    @Resource
    private AppInvitationCardMapper appInvitationCardMapper;

    @Override
    public void saveAppInvitation(AppInvitationCard appInvitationCard) {
        if (Objects.isNull(appInvitationCard.getId())) {
            appInvitationCardMapper.insert(appInvitationCard);
            return;
        }
        appInvitationCardMapper.updateById(appInvitationCard);
    }
}
